package com.bindapp.adapter;

import android.content.Context;
import android.support.v4.content.ContextCompat;

import com.bindapp.BR;
import com.bindapp.R;
import com.bindapp.databinding.ItemTab1ThreeBinding;
import com.bindapp.listener.RecyclerItemClick;

import java.util.List;

/**
 * Created by apple on 2018/6/29.
 */

public class MainTab1ThreeAdapter extends BaseRcAdapter {
    private Context context;
    private String[] labellist;
    private Integer[] imglist=new Integer[]{R.drawable.m1tab1,R.drawable.m1tab2,R.drawable.m1tab3,R.drawable.m1tab4,R.drawable.m1tab5,R.drawable.m1tab6};
    private Integer[] testnumlist=new Integer[]{10,15,45,25,12,68,12};
    public MainTab1ThreeAdapter(Context context, List<Object> datas, int layoutId, int mVariableId, RecyclerItemClick listener) {
        super(datas, layoutId, mVariableId, listener);
        this.context=context;
        labellist=context.getResources().getStringArray(R.array.tab1threelabel);
    }

    @Override
    public void BinderHolder(BaseHolder holder, int position) {
        if(holder instanceof ContentHolder){
            holder.getBinding().setVariable(BR.labelname,labellist[position]);
            holder.getBinding().setVariable(BR.img, ContextCompat.getDrawable(context,imglist[position]));
            ((ItemTab1ThreeBinding)holder.getBinding()).numview.setText(""+testnumlist[position]);
            //holder.getBinding().setVariable(mVariableId,ContextCompat.getDrawable(context,(int)datas.get(position)));
            //((ContentHolder)holder).getBinding().setVariable(BR.tabname,"-->"+position);
        }
    }
}
